<?php

/*
Edit Shop (admin_edit_shop.php)
*/

$page_title = "Edit Shop";
$rank_check = 7;
include "../header.inc.php";

print "$openHTML";

if (!$act)
{
	$findEnemies = mysql_query("SELECT * FROM official_shops2 WHERE game = '$game'");
	while ($getEnemies = mysql_fetch_array($findEnemies))
	{	
		$enemyList .= "<option value=$getEnemies[id]>$getEnemies[shop_name]</option>";
	}
	
ECHO <<<END

<FORM ACTION="admin_edit_shop.php?game=$game&act=edit" METHOD=POST> <CENTER><TABLE BGCOLOR="$tableOutline"
CELLSPACING=1 CELLPADDING=0 WIDTH=520> <TR BGCOLOR="$topAndBottomBG"> <TD COLSPAN=2 HEIGHT=50>
<CENTER><FONT SIZE="+2" COLOR="$topAndBottomText">--Edit Shop--</FONT></CENTER> </TD> </TR>
<TR BGCOLOR="$maincellColor"> <TD WIDTH=128 HEIGHT=40> <P>Edit Shop</P> </TD> <TD
HEIGHT=40> <P><FONT SIZE="-1">&nbsp;<select name=edit_shop>$enemyList</select></FONT></P> </TD> </TR> <TR> <TD
COLSPAN=2 HEIGHT=30 BGCOLOR="$topAndBottomBG"> <CENTER><FONT SIZE="-1" COLOR="$topAndBottomText"><I><INPUT
TYPE=submit NAME=Submit VALUE="Edit Shop!!"></I></FONT></CENTER> </TD> </TR>
</TABLE> </CENTER> </FORM>

END;

}

if ($act == "edit")
{

$findEnemy = fetch("SELECT * FROM official_shops2 WHERE game = '$game' AND id = '$edit_shop'");

if ($findEnemy[premium_only] == 1) { $premiumCheck = " CHECKED"; }
$att = $findEnemy[shop_keeper_attitude];
$select[$att] = " SELECTED";

ECHO <<<END

<P><FORM ACTION="admin_edit_shop.pro.php?game=$game&edit=$edit_shop" enctype="multipart/form-data" METHOD=POST>

<CENTER><TABLE BGCOLOR="$tableOutline"
CELLSPACING=1 CELLPADDING=0 WIDTH=520> <TR BGCOLOR="$topAndBottomBG"> <TD COLSPAN=2 HEIGHT=50>
<CENTER><FONT SIZE="+2" COLOR="$topAndBottomText">--Edit Shop--</FONT></CENTER> </TD> </TR>

<TR
BGCOLOR="#FFFFFF"> <TD WIDTH=128 HEIGHT=40> <P>Shop Name</P> </TD> <TD HEIGHT=40>
<P><FONT SIZE="-1">&nbsp;<INPUT TYPE=text NAME="add_shop_name" VALUE="$findEnemy[shop_name]" SIZE=43
MAXLENGTH=36></FONT></P> </TD> </TR>

<TR BGCOLOR="$reallyLight"> <TD WIDTH=128 HEIGHT=40>
<P>Shop Keeper Name:</P> </TD> <TD HEIGHT=40> <P><FONT SIZE="-1">&nbsp;<INPUT TYPE=text
NAME="add_keeper_name" VALUE="$findEnemy[shop_keeper]" SIZE=43 MAXLENGTH=36></FONT></P> </TD> </TR>

<TR BGCOLOR="#FFFFFF"> <TD WIDTH=128 HEIGHT=40> <P>Shop Keeper Image</P> </TD> <TD HEIGHT=40>
<P><FONT SIZE="-1">&nbsp;<input type=file name=keeperImage><br>&nbsp;<input type=checkbox name=use_shopkeeper value=1 CHECKED> (check ONLY if you want to use a shopkeeper)</FONT></P> </TD> </TR>

<TR
BGCOLOR="$reallyLight"> <TD WIDTH=128 HEIGHT=40> <P>Shop Keeper Greeting:</P> </TD> <TD HEIGHT=40>
<P><FONT SIZE="-1">&nbsp;<INPUT TYPE=text NAME="add_shop_greeting" VALUE="$findEnemy[shop_greeting]" SIZE=43
MAXLENGTH=64><br>&nbsp;Attitude:<select name=keeper_att><option value=0$selectAtt[0]>Extremely Nice<option value=1$selectAtt[1]>Fairly Nice<option value=2$selectAtt[2]>Nice<option value=3$selectAtt[3]>Average<option value=4$selectAtt[4]>Rude<option value=5$selectAtt[5]>Mean<option value=6$selectAtt[6]>VERY Mean</select></FONT></P> </TD> </TR>

<TR BGCOLOR="#FFFFFF"> <TD WIDTH=128 HEIGHT=40> <P>Premium Members Only?</P> </TD> <TD HEIGHT=40>
<P><FONT SIZE="-1">&nbsp;<input type=checkbox name=premium_only value=1$premiumCheck> (check ONLY if you want to ONLY allow premium members)</FONT></P> </TD> </TR>

<TR BGCOLOR="$reallyLight"> <TD WIDTH=128 HEIGHT=40> <P>Enable SmartHaggle?</P> </TD> <TD HEIGHT=40>
<P><FONT SIZE="-1">&nbsp;<input type=checkbox name=haggling value=1> (check ONLY if you want to enable the "<a href=../smarthaggle.php?game=$game target=_blankt>SmartHaggle</a>" system)</FONT></P> </TD> </TR>

<TR> <TD
COLSPAN=2 HEIGHT=30 BGCOLOR="$topAndBottomBG"> <CENTER><FONT SIZE="-1" COLOR="$topAndBottomText"><I><INPUT
TYPE=submit NAME=Submit VALUE="Edit Shop!!"></I></FONT></CENTER> </TD> </TR> </TABLE>
</CENTER> </FORM></P>

END;
}

print "$closeHTML";
?>
